package diet

import (
	"github.com/bgmp/config"
	"github.com/bgmp/middleware"
	"github.com/bgmp/model"
	"github.com/gin-gonic/gin"
)

func (b Base) ListDiets(c *gin.Context, req *ListDietsRequest) *ListDietsResponse {
	diets := model.ListDietViews(config.DB,
		map[string]any{model.Diet_UserId: middleware.GetUserId(c)},
		&model.DietSelectConditions{},
	)
	return &ListDietsResponse{
		Diets: diets,
	}
}

type ListDietsRequest struct {
}

type ListDietsResponse struct {
	Diets []model.DietView `json:"diets"`
}
